//package com.es.disped.core.shiro;
//
//import java.util.HashMap;
//import java.util.Map;
//
//import javax.servlet.Filter;
//import javax.servlet.ServletRequest;
//import javax.servlet.ServletResponse;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
//import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
//import org.apache.shiro.web.util.WebUtils;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.apache.shiro.mgt.SecurityManager;
//
//@Configuration
//public class ShiroConfig {
//	
//    @Bean
//    public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
//        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
//        shiroFilterFactoryBean.setSecurityManager(securityManager);
////        Map<String, Filter> filters = new HashMap<>();
////        filters.put("authc", filter);
////        filters.put("roles", filter);
////        filters.put("perms", filter);
////        shiroFilterFactoryBean.setFilters(filters);
//        Map<String, Filter> filterMap = shiroFilterFactoryBean.getFilters();
//        filterMap.put("authc", new ShrioAuthenticationFilter());
//        
//        Map<String, String> filterChainDefinitionMap = new HashMap<String, String>();
//        /*
//         * /swagger-ui.html = anon
//            	/swagger-resources/** = anon
//            	/v2/** = anon
//            	/webjars/** = anon
//                /resources/** = anon
//                /common/login/** = anon
//                /sms/send/code = anon
//                /wechat/message/** = anon
//                 /** = authc
//         * */
//        filterChainDefinitionMap.put("/swagger-ui.html", "anon");
//        filterChainDefinitionMap.put("/v2/**", "anon");
//        filterChainDefinitionMap.put("/webjars/**", "anon");
//        filterChainDefinitionMap.put("/resources/**", "anon");
//        filterChainDefinitionMap.put("/common/login/**", "anon");
//        filterChainDefinitionMap.put("/sms/send/code", "anon");
//        filterChainDefinitionMap.put("/wechat/message/**", "anon");
//        filterChainDefinitionMap.put("/**", "authc");
//        shiroFilterFactoryBean.setLoginUrl("/common/login/sign/in");
//        shiroFilterFactoryBean.setSuccessUrl("/index");
//        shiroFilterFactoryBean.setUnauthorizedUrl("/403/error");
//        shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
//        return shiroFilterFactoryBean;
//    }
//}
